﻿using Microsoft.AspNetCore.Mvc;
using Rj.PersonnelVerification.Server.Servers;
using Rj.PersonnelVerification.Shared.Models.Request;

namespace Rj.PersonnelVerification.Server.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class VerificationController : ControllerBase
    {
        private IPersonVerficaService PersonVerficaService;

        public VerificationController(IPersonVerficaService personVerficaService)
        {
            PersonVerficaService = personVerficaService;
        }

        /// <summary>
        /// 根据条件查询未上传数据
        /// </summary>
        /// <returns></returns>
        [HttpPost("QueryByExample")]
        public async Task<IActionResult> QueryNoUploadByExample(QueryNoUploadRequest request)
        {
            var responses=await PersonVerficaService.QueryNoUploadByExample(request);
            return Ok(responses);
        }

        [HttpPost("Upload")]
        public async Task<IActionResult> Upload(VerificationUploadRequest request)
        {
            var claim=HttpContext.User.Claims.FirstOrDefault(f => f.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier");
            var result=await PersonVerficaService.Upload(request, claim);
            return Ok(result);
        }
    }
}
